module.exports = {
  // 生产环境是否生成sourceMap文件
  productionSourceMap: false,

  css: {
    // 是否将css提取出来为单独的一个css文件
    extract: false
  },
  // cors 相关 https://jakearchibald.com/2017/es-modules-in-browsers/#always-cors
  // corsUseCredentials: false,
  // webpack 配置，键值对象时会合并配置，为方法时会改写配置
  // https://cli.vuejs.org/guide/webpack.html#simple-configuration
  // 调整 webpack 配置
  configureWebpack:config => {
    config.entry.app = './src/lib/index.js'
    config.output.filename = 'js/dgForm-[hash:8].js'
    config.devtool = "source-map"
  },
  filenameHashing: true,
  publicPath: './',
  // webpack 链接 API，用于生成和修改 webapck 配置
  // https://github.com/mozilla-neutrino/webpack-chain
  //对内部的 webpack 配置进行更细粒度的修改 
  // https://github.com/neutrinojs/webpack-chain see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].template = './index.html'
        args[0].inject = 'head'
        args[0].minify = false
        return args
      })
    config.optimization
      .splitChunks({
        cacheGroups: {}
      })
  }
}